
const cloud = require('wx-server-sdk')
cloud.init({
  env: "cloud1-0goai1xg04c52bfc"
});

const getOpenId = require('./getOpenId/index');
const getMiniProgramCode = require('./getMiniProgramCode/index');
const createCollection = require('./createCollection/index');
const selectRecord = require('./selectRecord/index');
const updateRecord = require('./updateRecord/index');
const sumRecord = require('./sumRecord/index');
const fetchGoodsList = require('./fetchGoodsList/index');
const genMpQrcode = require('./genMpQrcode/index');
const sendSms = require('./sendSms/index');
const getUserInfo = require('./getUserInfo/index');
const setUserInfo = require('./setUserInfo/index');
const getDataList = require('./getDataList/index');
const setOrderTickets = require('./setOrderTickets/index');
const setOrderHotels = require('./setOrderHotels/index');
const setOrderShops = require('./setOrderShops/index');
const getMyComment = require('./getMyComment/index');
const setComment = require('./setComment/index');
const setAddress = require('./setAddress/index');
const setUserRegister = require('./setUserRegister/index');

// 云函数入口函数
exports.main = async (event, context) => {
  console.log("云函数入口函数===type="+event.type);
  switch (event.type) {
    case 'setUserRegister'://数据库-用户注册会员
      return await setUserRegister.main(event, context);
    case 'setAddress'://数据库-存入通讯地址
      return await setAddress.main(event, context);
    case 'setComment'://插入评价列表
      return await setComment.main(event, context);
    case 'getMyComment'://获取我的评价列表
      return await getMyComment.main(event, context);
      case 'setOrderShops'://插入商品订单数据
        return await setOrderShops.main(event, context);
    case 'setOrderTickets'://插入门票订单数据
      return await setOrderTickets.main(event, context);
    case 'setOrderHotels'://插入酒店订单数据
      return await setOrderHotels.main(event, context);
    case 'getDataList'://获取某个集合的列表数据
      return await getDataList.main(event, context);
    case 'setUserInfo'://插入用户信息
      return await setUserInfo.main(event, context);
    case 'getUserInfo'://获取用户信息
      return await getUserInfo.main(event, context);
    case 'sendSms'://发送验证码
      return await sendSms.main(event, context);
    case 'getOpenId':
      return await getOpenId.main(event, context);
    case 'getMiniProgramCode':
      return await getMiniProgramCode.main(event, context);
    case 'createCollection':
      return await createCollection.main(event, context);
    case 'selectRecord':
      return await selectRecord.main(event, context);
    case 'updateRecord':
      return await updateRecord.main(event, context);
    case 'sumRecord':
      return await sumRecord.main(event, context);
    case 'fetchGoodsList':
      return await fetchGoodsList.main(event, context);
    case 'genMpQrcode':
      return await genMpQrcode.main(event, context);
  }
};
        
